import React, { useState } from 'react';
import { Button } from 'antd';

const BtnSwitch = ({ onChange, defaultValue, valueList, swichList, sign }) => {
  const [value, setValue] = useState(defaultValue === valueList[0]);
  const changeValue = () => {
    setValue(!value);
    onChange(valueList[!value ? 0 : 1], sign);
  };
  return (
    <Button onClick={changeValue} type="primary" shape="circle">
      {swichList[value ? 0 : 1] || 'NO'}
    </Button>
  );
};
export default BtnSwitch;
